<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<html lang="en">
	<head>
	    <meta charset="UTF-8">
	    <script type="text/javascript" src="/statics/js/jquery-3.1.0.min.js"></script>
	    <style type="text/css">
	    	td{text-align: center;}
	    </style>
	    <script type="text/javascript">
	    	$(function(){
	    		$('.delete-a').click(function(){
	    			window.location.href='/teacher/delete.htm?id='+ $(this).data('id');
	    		});
	    	})
	    	
	    </script>
	</head>
	<body>
		<div style="width: 100%;">
		<a href="/teacher/input.htm">新增</a>
		<br/>
		search <br/>
		<form action="/teacher/list.htm" method="post">
			name: <input type="text" name="name" value="${name}"/>
			<input type="submit" value="search"/>
			id: <input type="text" name="id" value="${id}"/>
			<input type="submit" value="search"/>
		</form>
			<table border="1">
			<table border="1" style="width: 100%;">
				<tr>
					<td>序号</td>
					<td>姓名</td>
					<td>年龄</td>
					<td>编辑</td>
				</tr>
				<c:forEach items="${teachers}" var="t">
				<tr>
					<td>${t.id}</td>
					<td>${t.name}</td>
					<td>${t.age}</td>
					<td><a href="/teacher/input.htm?id=${t.id}">编辑</a> | <a class="delete-a" href="#" data-id="${t.id}">删除</a></td>
				</tr>
				</c:forEach>
			</table>
			<c:if test="${(pageNo-1)>=0}">
				<a href="/teacher/list.htm?pageNo=${pageNo-1}">上一页</a>
			</c:if>
			<c:if test="${(pageNo+1) < totalPageNo}">
				<a href="/teacher/list.htm?pageNo=${pageNo+1}">下一页</a>
			</c:if>
		</div>
	</body>
</html>